package org.feng.support;

import lombok.Data;
import org.feng.base.enums.ErrorCode;
import org.feng.exception.ServiceException;
import org.feng.vo.SmsMessageVO;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @Author feng
 * @Date 2022/6/7 14:54
 * @Description TODO
 */
@Component
@ConfigurationProperties(prefix = "sms")
@Data
public class SmsBuild {
    private String smsType;
    private String accessKeyId;
    private String accessKeySecret;

    public SmsClient build(SmsMessageVO messageVO) {

        if (smsType.equals("0")) {
            return new AliSmsClient(accessKeyId, accessKeySecret);
        }

        if (smsType.equals("1")) {

        }
        throw new ServiceException(ErrorCode.SMS_NOT_EXIST);
    }
}
